package cn.edu.hpu.web;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import cn.edu.hpu.dao.IdeaCommentDao;
import cn.edu.hpu.entity.Employee;
import cn.edu.hpu.utitl.TimeUtitl;
import cn.edu.hpu.utitl.UUIDUtitl;

public class IdeaCommentServlet extends HttpServlet {

	private static final long serialVersionUID = 1L;

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		response.setContentType("text/html;charset=GBK");
		String iid = request.getParameter("iid");
		String iccontent = request.getParameter("iccontent");
		String icid = UUIDUtitl.getUUID();
		String icctime = TimeUtitl.getTime();
		HttpSession session = request.getSession();
		Employee e = (Employee)session.getAttribute("employee");
		String eid = e.getEid();
		IdeaCommentDao icd = new IdeaCommentDao();
		try {
			icd.insertIdeaComment(icid, iccontent, icctime, iid, eid);
			request.getRequestDispatcher("/WEB-INF/views/idea.jsp").forward(request, response);
		} catch (Exception e2) {
			e2.printStackTrace();
		}
	}

}
